<?php

namespace yiike\core\models;

use Yii;
use \yiike\core\models\base\NoticeRead as BaseNoticeRead;

/**
 * This is the model class for table "core_notice_read".
 */
class NoticeRead extends BaseNoticeRead
{
    public static function findOne($id) {
        $model = parent::findOne($id);
        if (! $model) {
            $model = new NoticeRead();
            $model->user_id = $id;
            $model->read_at = 0;
            $model->save();
        }
        return $model;
    }
}
